<template>
  <by-background />

  <by-navigation-bar title="提现" />

  <view class="padding-20">
    <view class="padding-tb-10 padding-lr-20 bg-white card">
      <by-cell
          v-model="form[item.value]"
          v-for="(item,index) in list"
          :key="index"
          :label="item.label"
          :border="index < list.length - 1"
          :placeholder="`请输入${item.label}`"
          type="text"
      />
    </view>

    <view class="margin-top-40 text-center">
      <text class="text-26 color-t2">请填写实名认证的支付宝账号</text>
    </view>
  </view>

  <by-bottom-button height="72rpx" font-size="32rpx" bold text="提 交" @click="submit"/>
</template>

<script setup lang="ts">
import { addWithdrawInfo } from '@/common/api'
import { toast } from '@/common/util'
const list = [
  { label: '姓名', value: 'name' },
  { label: '支付宝账号', value: 'payeeAccount' }
]

const form = reactive({
  name: '',
  payeeAccount: ''
})

async function submit() {
  if (!form.name) {
    toast('请输入姓名')
    return
  }
  if (!form.payeeAccount) {
    toast('请输入支付宝账号')
    return
  }
  await addWithdrawInfo(form)
  toast('提交成功')
}
</script>

<style scoped lang="scss">
.card{
  border-radius:16rpx;
}
</style>
